<template>
  <view class="hot-panel">
    <view class="hot-item" v-for="item in list" :key="item.id" @click="handleHotItemClick(item)">
      <view class="item-top">
        <text class="item-title">{{ item.title }}</text>
        <text class="item-desc">{{ item.alt }}</text>
      </view>
      <view class="item-bottom">
        <image class="item-img" v-for="img in item.pictures" :key="img" :src="img" mode=""></image>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import type { HotShopItem } from "@/types";
defineProps<{
  list: HotShopItem[];
}>();

const handleHotItemClick = (item: HotShopItem) => {
  uni.navigateTo({
    url: `/pages/hot/hot?type=${item.type}`,
  });
};
</script>

<style lang="scss">
.hot-panel {
  display: flex;
  flex-wrap: wrap;
  min-height: 508rpx;
  margin: 20rpx 20rpx 0;
  border-radius: 10rpx;
  background-color: #fff;

  .hot-item {
    width: 50%;
    height: 254rpx;
    border-right: 1rpx solid #eee;
    border-top: 1rpx solid #eee;

    &:nth-child(2n) {
      border-right: 0 none;
    }

    &:nth-child(-n + 2) {
      border-top: 0 none;
    }

    .item-top {
      display: flex;
      align-items: center;
      padding: 24rpx 24rpx 0;
      font-size: 32rpx;
      color: #262626;
      position: relative;
      justify-content: start;

      .item-desc {
        font-size: 24rpx;
        color: #7f7f7f;
        margin-left: 18rpx;
      }
    }

    .item-bottom {
      flex: 1;
      padding: 15rpx 20rpx;
      display: flex;
      justify-content: space-between;
      align-items: center;

      .item-img {
        width: 150rpx;
        height: 150rpx;
      }
    }
  }
}
</style>
